﻿using DevExpress.XtraGrid.Demos.util;
using DXApplicationTangche.DTO;
using DXApplicationTangche.UC.订单一览新.销售确认单;
using mendian;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DXApplicationTangche.UC.标签打印.Service
{
    public class 发运Service
    {
        /// <summary>
        /// 批号顺丰发运
        /// </summary>
        /// <param name="size"></param>
        /// <param name="customerTagRecordDTOs"></param>
        /// <returns></returns>
        public static SfExpressMessageResult sfExpressOrderByBatchNo(int size, String batchNo)
        {
            return
                FunctionHelper.JsonDeserialization<SfExpressMessageResult>(
                    RestCall.PostHttp(
                        URL.接口url + "/sf/sfExpressOrderByBatchNo?size=" + size,
                        batchNo
                        )
                    );
        }
        /// <summary>
        /// 客户套号顺丰发运
        /// </summary>
        /// <param name="size"></param>
        /// <param name="customerTagRecordDTOs"></param>
        /// <returns></returns>
        public static SfExpressMessageResult sfExpressCustomerTagOrder(int size, List<CustomerTagRecordDTO> customerTagRecordDTOs)
        {
            return
                FunctionHelper.JsonDeserialization<SfExpressMessageResult>(
                    RestCall.PostHttp(
                        URL.接口url + "/sf/sfExpressCustomerTagOrder?size=" + size,
                        FunctionHelper.JsonSerialization(customerTagRecordDTOs)
                        )
                    );
        }

        /// <summary>
        /// 根据生产批号和水洗生成顺丰发货贴
        /// </summary>
        /// <param name="size"></param>
        /// <param name="customerTagRecordDTOs"></param>
        /// <returns></returns>
        public static SfExpressMessageResult sfExpressOrderByBatchNoAndBarcodes(String batchNo,int size, List<String> barcodes)
        {
            String xx = FunctionHelper.JsonSerialization(barcodes);
            return
                FunctionHelper.JsonDeserialization<SfExpressMessageResult>(
                    RestCall.PostHttp(
                        URL.接口url + "/sf/sfExpressOrderByBatchNoAndBarcodes?batchNo=" + batchNo + "&size=" + size,
                        FunctionHelper.JsonSerialization(barcodes)
                        )
                    );
        }

        /// <summary>
        /// 顺丰打印订单判断是否为坚山订单
        /// </summary>
        /// <param name="size"></param>
        /// <param name="customerTagRecordDTOs"></param>
        /// <returns></returns>
        public static SfExpressMessageResult sfExpressOrderByBatchNoForKashiyama(String batchNo, int size)
        {
            return
                FunctionHelper.JsonDeserialization<SfExpressMessageResult>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/sf/sfExpressOrderByBatchNoForKashiyama?batchNo=" + batchNo + "&size=" + size
                        )
                    );
        }
    }
}
